package com.googlecode.flealancemarket.metamodel.beans;

import com.googlecode.flealancemarket.core.beans.BaseBean;
import com.googlecode.flealancemarket.metamodel.Category;
import com.googlecode.flealancemarket.metamodel.CategoryGroup;
import com.googlecode.flealancemarket.metamodel.Job;
import java.util.List;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
public class CategoryBean extends BaseBean implements Category {

    private CategoryGroup categoryGroup;
    private String name;
    private List<Job> jobs;

    @ManyToOne(targetEntity=CategoryGroupBean.class, fetch = FetchType.EAGER)
    @JoinColumn(name = "CATEGORYGROUP__ID")
    public CategoryGroup getCategoryGroup() {
        return categoryGroup;
    }

    public void setCategoryGroup(CategoryGroup categoryGroup) {
        this.categoryGroup = categoryGroup;
    }
    @Basic
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public CategoryBean() {
        super();
    }
    
    public CategoryBean(String name) {
        this.name = name;
    }

    @OneToMany(targetEntity=JobBean.class, fetch=FetchType.LAZY, mappedBy="category")
    public List<Job> getJobs() {
        return jobs;
    }

    public void setJobs(List<Job> jobs) {
        this.jobs = jobs;
    }
    
}